<?php

$api = app('Dingo\Api\Routing\Router');

$api->version('V1',[
    'namespace'=>'App\Http\Controllers\Api\V1\Frontend\Auth'
],function ($api){
    $api->group([
        'prefix' => 'frontend'
    ],function ($api){
        $api->group([
            'prefix' => 'auth'
        ],function ($api){
            //用户登录
            $api->post('login','IndexController@login')
                ->middleware('throttle:login')
                ->name('frontend.auth.login.post');

            //用户登录，只验证用户名
            $api->post('loginByUsername','IndexController@loginByUsername')
                ->middleware('throttle:login')
                ->name('frontend.auth.loginByUsername.post');

            //用户登录获取手机验证码
            $api->get('sendSMSVerifycode','IndexController@sendSMSVerifycode')
                ->name('frontend.auth.sendSMSVerifycode.get');

            //用户的token验证
            $api->get('check','IndexController@check')
                ->middleware('jwt.token')
                ->name('frontend.auth.check.get');

            //安全退出
            $api->put('logout','IndexController@logout')
                ->middleware('jwt.token')
                ->name('frontend.auth.logout.put');
        });
    });
});
